package cn.edu.hunau.oop.day03;

import java.util.Arrays;

/**
 * @author hb
 * @date 2025-08-06 16:35:01
 */
public class Player {
    private String name;
    private Card[] cards;

    public Player(String name) {
        this.name = name;
        cards = new Card[0];
    }

    @Override
    public String toString() {
        return "Player{" +
                "name='" + name + '\'' +
                ", cards=" + Arrays.toString(cards) +
                '}';
    }

    //构造器

    //拿牌
    public void addCard(Card card){
         //先扩容
         this.cards = Arrays.copyOf(cards, cards.length+1);
         this.cards[this.cards.length-1]=card;

    }

    public String getName() {
        return name;
    }

    public Card[] getCards() {
        return cards;
    }
}
